home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
aminet
/
dev
/
lang
/
sbp3_1e.lzh
/
FORALL.PL
< prev
next >
Wrap
Text File
|
1991-10-31
|
802b
|
33 lines
/* From the book PROLOG PROGRAMMING IN DEPTH
by Michael A. Covington, Donald Nute, and Andre Vellino.
Copyright 1988 Scott, Foresman & Co.
Non-commercial distribution of this file is permitted. */
/* Modified for Quintus Prolog by Andreas Siebert */
/* FORALL.PL */
/*****************************************
* for_all(GoalA,GoalB) *
* Succeeds if all instantiations that *
* satisfy GoalA also satisfy GoalB. *
* (There must be at least one such *
* instantiation.) *
*****************************************/
for_all(GoalA,GoalB) :-
\+ (call(GoalA), \+ call(GoalB)),
call(GoalA),
!.
/* Test knowledge base */
dog(fido).
dog(rover).
dog(X) :- bulldog(X).
bulldog(bucephalus).
animal(X) :- dog(X).
animal(felix).